
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.IO;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace ScrewTurn.Wiki {

	public partial class Upload : BasePage {

        protected void Page_Load(object sender, EventArgs e) {
            Page.Title = Resources.Messages.UploadTitle + " - " + Settings.WikiTitle;

			lblDescription.Text = lblDescription.Text.Replace("##MAXFILESIZE##", Tools.BytesToString(Settings.MaxFileSize * 1024));

			if(SessionFacade.LoginKey != null) {
				// Registered User
				if(!SessionFacade.Admin) {
					// Normal User
					if(!Settings.UsersCanViewFiles) Response.Redirect("AccessDenied.aspx");
				}
				// Else: User is an Admin, therefore can do any operation
			}
			else {
				// Anonymous User
				if(!Settings.PublicAccess) Response.Redirect("Login.aspx?Redirect=Upload.aspx");
				else {
					// Public Access
					if(!Settings.UsersCanViewFiles) Response.Redirect("Login.aspx?Redirect=Upload.aspx");
					else {
						if(!Settings.FileManagementInPublicAccessAllowed) Response.Redirect("Login.aspx?Redirect=Upload.aspx");
					}
				}
			}

        }

    }

}
